﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<nelech.Models.DBModel.Advert>>" %>
<% 
    if (Model.Count() == 0)
    {
%>
<h2>
    נלך - טיולים באווירה יהודית
</h2>
<h3>
    לפרסום: 050-8421043
</h3>
<%
    }
    else
    {
        foreach (var advert in Model)
        {
            if (!string.IsNullOrEmpty(advert.swf))
            {
                int id = (int)ViewData["Id"]; %>
<%string height = nelech.Views.Shared.Code.Utils.AdvertHeight(id);
  string width = nelech.Views.Shared.Code.Utils.AdvertWidth(id);        
%>
<object codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
    classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="<%= width %>" height="<%= height %>">
 
   
    <param name="Movie" value="<%= advert.swf %>">
  
    <embed src='<%= advert.swf %>' quality="hieght" wmode='opaque' width='<%= width %>'
        height='<%= height %>' type='application/x-shockwave-flash' pluginspace='http://www.adobe.com/go/getflashplayer'
        allowscriptaccess='never' flashvars=""></embed>
</object>
<%
            }
            else
            {
                var advertImg = System.IO.Path.GetFileName(advert.image);


                if (!string.IsNullOrEmpty(advert.pdf))
                {
                    Response.Write("<a href=\"http://nelech.co.il" + advert.pdf + "\" target='_blank'><img class=\"advert\" src=\"/Advert/" + advertImg + "\" alt=\"" + advert.name + "\" /></a>");

                }
                else if (!string.IsNullOrEmpty(advert.link))
                {


                    Response.Write("<a href=\"" + advert.link + "\" target='_blank'><img class=\"advert\" src=\"/Advert/" + advertImg + "\" alt=\"" + advert.name + "\" /></a>");
                }

                else if (!String.IsNullOrEmpty(advert.image))
                {

                    Response.Write("<a href=\"http://nelech.co.il/" + advert.bigImg + "\" target='_blank'><img class=\"advert\" src=\"/Advert/" + advertImg + "\" alt=\"" + advert.name + "\" /></a>");
                }


            }
        }
    }
%>
